// 仅修改themes主题配置
$themes: (
    light:(bgColor: #efefef,
        divColor:#fff,
        cardColor: #fff,
        textColor: #212121,
        textActiveColor: #000,
        borderColor: gray,
        iconColor: #666666,
        iconActiveColor: #383838,
    ),
    dark:(bgColor: #292929,
        divColor:#334155,
        cardColor: #34373b,
        textColor: #d7d7d7,
        textActiveColor: #fff,
        borderColor: gray,
        iconColor: #BDBDBD,
        iconActiveColor: #e5e4e4,
    )
);

$curTheme: 'light';

@mixin useTheme() {

    //循环主题对象的每一个属性
    @each $key,
    $value in $themes {
        // 覆盖全局变量
        $curTheme: $key !global;

        //自定义属性data-xx
        html[data-theme="#{$key}"] & {
            // 占位符，调用时传参
            @content;
        }
    }

}

// 获取不同主题下的配置的颜色,从主题对象中获取
@function getVar($paramName) {
    // 获取对应主题的对象
    $themeMap: map-get($themes, $curTheme);
    @return map-get($themeMap, $paramName)
}